import delimited "$dir/Model/Simulated_data/simulated_data_movecosts.csv", clear

//            line = [fips[l] fips[lp] skill_prices[l] prim_2010.skill_prices[lp] m mp t e2p e3p h3p_val ap S_par S pops[l] mig e3_fam e3p_fam]


//rename
ren v1 state_born
ren v2 state_move
drop v3 v4
ren v5 parent_marr
ren v6 kid_marr
ren v7 parent_time_inv
ren v8 kid_earn_p2
ren v9 kid_earn_p3
ren v10 kid_hc_p3
ren v11 ability
ren v12 coll_par
ren v13 coll_kid
ren v14 weight	
ren v15 mig
ren v16 type
ren v17 mig2
ren v18 lp_norec
ren v19 state_p2
ren v20 race
ren v21 region
ren v22 util
ren v23 movecost_p2
ren v24 locshock_p2
ren v25 movecost_p3
ren v26 locshock_p3
ren v27 con_p2
ren v28 con_p3
ren v29 locshock_home_p2
ren v30 locshock_home_p3
ren v31 parent_fam_earn
ren v32 kid_fam_earn
ren v33 parent_pctile
ren v34 kid_pctile



gen cost_net_p2 = 0
replace cost_net_p2 = movecost_p2 - (locshock_p2-locshock_home_p2) if mig


gen cost_net_p3 = 0
replace cost_net_p3 = movecost_p3 - (locshock_p3-locshock_home_p3) if mig2


su movecost_p2 if mig
su movecost_p3 if mig2

su cost_net_p2 if mig
su cost_net_p3 if mig2

su con_p2 con_p3


